Making operations on standard-library containers strongly exception safe∗
نویسنده
چکیده
An operation on an element container is said to provide a strong guarantee of exception safety if, in case an exception is thrown, the operation leaves the container in the state in which it was before the operation. In this paper, we explore how to adjust operations on C++ standard-library containers to provide the strong guarantee of exception safety, instead of the default guarantee, without violating the stringent performance requirements specified in the C++ standard. In particular, we show that every strongly exception-safe operation on dynamic arrays and ordered dictionaries is only a constant factor slower than the corresponding defaultguarantee operation. In terms of the amount of space, the overhead introduced is linear in the number of elements stored.
منابع مشابه
Semantic-Driven Parallelization of Loops Operating on User-Defined Containers
We describe ROSE, a C++ infrastructure for source-to-source translation, that provides an interface for programmers to easily write their own translators for optimizing user-defined high-level abstractions. Utilizing the semantics of these high-level abstractions, we demonstrate the automatic parallelization of loops that iterate over user-defined containers that have interfaces similar to the ...
متن کاملStronger guarantees for standard-library containers
The Standard Template Library (STL) [13, 14] is a library of generic algorithms and data structures that has been incorporated in the C++ standard [1] and ships with all modern C++ compilers. In the CPH STL project [4] our goal is to implement an enhanced edition of the STL. Initially, our focus was on time and space efficiency of the STL components, but now we are also focusing on safety, reli...
متن کاملSFIO: Safe/Fast String/File IO
This paper describes Sfio, a new input/output library, that can be used as a replacement for Stdio, the C language standard I/O library. Sfio is more complete, consistent, and efficient than Stdio. New facilities are provided for convenient, safe and efficient manipulation of data streams. An Sfio stream may be entirely memory resident or it may correspond to some actual file. Alternative I/O d...
متن کاملOn the Reusability and Numeric Efficiency of C++ Packages in Scientific Computing
In this paper, we discuss the reusability and numerical efficiency of selected Object-Oriented numerical packages, serial and parallel, for developing high performance scientific computing applications. We selected packages that can be obtained freely on the internet and most of them are open source. Since the authors did not have extensive previous experience with all the packages, we believe ...
متن کاملMatrix Multiplication Specialization in STAPL
The Standard Template Adaptive Parallel Library (STAPL) is a superset of C++’s Standard Template Library (STL) which allows highproductivity parallel programming in both distributed and shared memory environments. This framework provides parallel equivalents of STL containers and algorithms enabling ease of development for parallel systems. In this paper, we will discuss our methodology for imp...
متن کامل